package com.caigou.modules.query.adpter

import androidx.recyclerview.widget.DefaultItemAnimator
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.caigou.comm.base.widget.SpaceItemDecoration
import com.caigou.modules.query.R
import com.caigou.modules.query.bean.ShengXiaoBallItemBean
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder

/**
 * @author #Suyghur.
 * Created on 2021/12/19
 */
class ShengXiaoBallItemAdapter(dataset: MutableList<ShengXiaoBallItemBean>) :
    BaseQuickAdapter<ShengXiaoBallItemBean, BaseViewHolder>(R.layout.item_sheng_xiao_list, dataset) {
    override fun convert(holder: BaseViewHolder, item: ShengXiaoBallItemBean) {
        holder.setText(R.id.item_sheng_xiao_tv_name, item.animalName)
        val ballAdapter = BallItemAdapter(item.numberList)
        holder.getView<RecyclerView>(R.id.item_sheng_xiao_recycler_view).run {
            layoutManager = LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false)
            adapter = ballAdapter
            itemAnimator = DefaultItemAnimator()
            addItemDecoration(SpaceItemDecoration(context))
        }

    }
}